home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / python-support / python2.6 / rdflib / syntax / serializers / NTSerializer.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  1.4 KB  |  25 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from rdflib.syntax.serializers import Serializer
  5.  
  6. class NTSerializer(Serializer):
  7.     
  8.     def __init__(self, store):
  9.         '''
  10.         I serialize RDF graphs in NTriples format.
  11.         '''
  12.         super(NTSerializer, self).__init__(store)
  13.  
  14.     
  15.     def serialize(self, stream, base = None, encoding = None, **args):
  16.         if base is not None:
  17.             print 'TODO: NTSerializer does not support base'
  18.         
  19.         encoding = self.encoding
  20.         
  21.         write = lambda triple: stream.write((triple[0].n3() + u' ' + triple[1].n3() + u' ' + triple[2].n3() + u'.\n').encode(encoding, 'replace'))
  22.         map(write, self.store)
  23.  
  24.  
  25.